<layout name="Layout/main"/>
<style>
    .del:hover{border:red solid 1px; background-color: red}
    .del{width:20px;border: #fff solid 1px;clear:both;}
    .edit:hover{border:#36bc9b solid 1px; background-color: #36bc9b}
    .edit{width:20px;border: #fff solid 1px;clear:both;}
</style>
<div class="content" style="height: 800px">
    <table id="ency_list">
        <thead>
         <form id="search" class="search-form" action="__APP__/admin/pet/ency" method="post">
             <div style="margin:20px 0 20px 300px;color: #000;">
             <span>宠物名称：</span><input name="pet_name" type="text" class="search-input" style="color: #000;"/>
             <span>宠物种类：<select name="category">
                     <option value="0">--请选择--</option>
                     <?php foreach($cate_list as $k => $v){?>
                     <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
                     <?php } ?>
                 </select>
             </span>
             <input type="submit" value="查询" class="search-input-btn" style="margin-left:400px;margin-top:-23px "/>
             </div>
         </form>

        </thead>
        <tbody>
            <tr>
                <th></th>
                <th class="text_100">编号</th>
                <th class="text_250">宠物名称</th>
                <th class="text_250">英文名</th>
                <th class="text_250">产地</th>
                <th class="text_200">宠物种类</th>
                <th class="text_200">操作</th>
            </tr>
            <?php foreach($ency_list as $k => $v){ $i += 1;?>
           <tr>
               <td></td>
               <td><?php echo $i ?></td>
               <td><?php echo $v['name']?></td>
               <td><?php echo $v['foreignname']?></td>
               <td><?php echo $v['chandi']?></td>
               <td><?php echo $v['category']?></td>
               <td>
                   <a class="edit" href="__APP__/admin/pet/ency_edit/id/<?php echo $v['id']?>"><i class="fa fa-pencil-square-o"></i>编辑</a>
                   <a class="del" enc_type="del" href="javascript:void(0)" data-id="<?php echo $v['id']?>"><i class="fa fa-trash"></i>删除</a>
               </td>
           </tr>
        <?php }?>
        </tbody>
    </table>
</div>
<script>
    $("a[enc_type='del']").click(function(){
        var id = $(this).attr('data-id');
        $.post('__APP__/admin/pet/del',{id:id},function(result){
            if(result){
                sweetAlert('删除成功');
            }else{
                sweetAlert('删除失败');
            }
            location.reload();
        });
    });
</script>